package com.st.controller;

import com.st.base.BaseResult;
import com.st.service.GoodsImgService;
import com.st.vo.goodsImgListVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(path = "goodsImg")
@Tag(name="商品图片",description = "集合了所有的商品图片的接口方法")
public class GoodsImgController {

    @Resource
    private GoodsImgService goodsImgService;

    @Operation(summary = "商品图片列表查询",description = "商品图片的查询接口非必传可以返回数组列表")
    @Parameters({
            @Parameter(name ="pageNumber",description = "页码",required = false),
            @Parameter(name ="pageSize",description = "页容量",required =false)
    })
    @RequestMapping(path = "List",method = RequestMethod.GET)
    public BaseResult<goodsImgListVo> getList(
            @RequestParam(name = "pageNumber",required = false,defaultValue = "1")Integer pageNumber,
            @RequestParam(name = "pageSize",required = false,defaultValue = "5")Integer pageSize
    ){
        List<goodsImgListVo> goodsImgListVos = goodsImgService.getList();

        if (goodsImgListVos!=null&&goodsImgListVos.size()>0){
            return BaseResult.ok(goodsImgListVos);
        }
        return BaseResult.error("数据不不正确");
    }
}
/*为了提交*/